package com.jctrip.hotel.management.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.jctrip.hotel.management.client.FeizhuClient;
import com.jctrip.hotel.management.model.param.*;
import com.jctrip.hotel.management.model.result.GetFliggyHotelResult;
import com.jctrip.hotel.management.model.result.GetHotelInfoResult;
import com.jctrip.hotel.management.model.result.Result;
import com.jctrip.hotel.management.service.HotelInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@Api(tags = "management-hotel")
@RestController
@RequestMapping("/management/hotel")
public class HotelInfoController {
    @Autowired
    private HotelInfoService hotelInfoService;

    @Autowired
    private FeizhuClient feizhuClient;

    /// todo 目前管理后台不接 岑浩开发时开启
//    @PostMapping("/gethotelInfo")
//    @ApiOperation(value = "gethotelInfo", notes = "获取标准酒店列表")
//    @ApiOperationSupport(order = 1)
//    public Result<GetHotelInfoResult> gethotelInfo(@RequestBody GetHotelInfoParam param){
//        return Result.ok(hotelInfoService.gethotelInfo(param));
//    }
//
//    @PostMapping("/editHotelsStatus")
//    @ApiOperation(value = "editHotelsStatus", notes = "修改酒店状态")
//    @ApiOperationSupport(order = 2)
//    public Result<Boolean> editHotelsStatus(@RequestBody UpdateHotelsStatusParam param){
//        return Result.ok(hotelInfoService.editHotelsStatus(param));
//    }

    @PostMapping("/getFliggyHotels")
    @ApiOperation(value = "getFliggyHotels", notes = "获取飞猪酒店匹配")
    @ApiOperationSupport(order = 3)
    public Result<GetFliggyHotelResult> getFliggyHotels(@RequestBody GetFliggyHotelParam param){
        return hotelInfoService.getFliggyHotels(param);
    }

    @GetMapping("/getStdHotel")
    @ApiOperation(value = "getStdHotel", notes = "获取标准酒店id")
    @ApiOperationSupport(order = 4)
    public Result<String> getStdHotel(@RequestParam("shid")Long shid){
        return feizhuClient.getStdHotel(shid);
    }

    @PostMapping("/updateFliggyHotelsStatus")
    @ApiOperation(value = "updateFliggyHotelsStatus", notes = "修改飞猪匹配状态")
    @ApiOperationSupport(order = 5)
    public Result<Boolean> updateFliggyHotelsStatus(@RequestBody UpdateFliggyHotelsStatusParam param){
        return hotelInfoService.updateFliggyHotelsStatus(param);
    }

    @PostMapping("/updateFliggyHotelsPrice")
    @ApiOperation(value = "updateFliggyHotelsPrice", notes = "飞猪酒店加价")
    @ApiOperationSupport(order = 6)
    public Result<Boolean> updateFliggyHotelsPrice(@RequestBody UpdateFliggyHotelsPriceParam param){
        return hotelInfoService.updateFliggyHotelsPrice(param);
    }

    @PostMapping("/matchHotelSelf")
    @ApiOperation(value = "matchHotelSelf", notes = "酒店匹配")
    @ApiOperationSupport(order = 7)
    public Result<Boolean> matchHotelSelf(@RequestBody UpdateHotelMatchParam param){
        return hotelInfoService.matchHotelSelf(param);
    }
}
